#!/usr/bin/env python
#-*- coding:utf-8 -*-

#*********************************
# FileName: ganzhi.py
# Author  : wule
# Date    : 2010.9.8
# Note    : 公元纪年转干支纪年
#*********************************


SHENGXIAO = {1:"鼠",2:"牛",3:"虎",4:"兔",5:"龙",6:"蛇",7:"马",8:"羊",9:"猴",10:"鸡",11:"狗",12:"猪"}
DIZHI = {1:"子",2:"丑",3:"寅",4:"卯",5:"辰",6:"巳",7:"午",8:"未",9:"申",10:"酉",11:"戌",12:"亥"}
TIANGAN = {1:"甲", 2:"乙", 3:"丙", 4:"丁", 5:"戊", 6:"己", 7:"庚", 8:"辛", 9:"壬", 0:"癸"}


def get_year_info(year):
    result = {}
    # 计算天干
    year_g = year % 10
    if year_g < 3: year_g += 10
    result['gan'] = year_g - 3
    # 计算地支
    year_d = year % 12 + 9
    if year_d > 12: year_d -= 12
    result['zhi'] = year_d
    result['ganzhinian'] = '%s%s年' %  (TIANGAN[result['gan']], DIZHI[result['zhi']])
    result['shengxiao'] = SHENGXIAO[result['zhi']]
    return result
    


if __name__ == '__main__':
    T = get_year_info(2010)
    for k in T:
        print k, T[k]
        
        
        
